ipolate canada time, gen (y)


ipolate argentina time, gen (y)
ipolate canada time, gen (y)
ipolate russia time, gen (y)
ipolate ukraine time, gen (y)


///Standardize data

sum  argentina australia canada eu russia ukraine usa oil urea
gen arg= (argentina-250.1366)/61.16356
gen aug= (australia-241.4439)/42.3817
gen cag= (canada-296.7659)/92.02522
gen eug= (eu-233.8878)/62.52632
gen rug= (russia-226.6878)/53.59114
gen ukg= (ukraine- 205.4683)/53.11637
gen usg= (usa-261.0634)/ 64.71787 
gen olg= (oil-70.92683)/24.97076
gen urg= (urea-313.9073)/ 133.5829

///New data

save "C:\Users\Kmottale\Documents\USA-Wheatprice\newwheat.dta",replace

gen time1=tm(2008m01)+_n-1
tsset time1, monthly

arg aug cag eug rug  ukg usg  olg urg

dfgls arg
dfgls d.arg
dfgls aug
dfgls d.aug
dfgls cag
dfgls d.cag
dfgls eug
dfgls d.eug
dfgls rug
dfgls d.rug
dfgls ukg
dfgls d.ukg
dfgls usg
dfgls d.usg
dfgls olg
dfgls d.olg
dfgls urg
dfgls d.urg


**# Bookmark #1
pperron arg
pperron d.arg
pperron aug
pperron d.aug
pperron cag
pperron d.cag
pperron eug
pperron d.eug
pperron rug
pperron d.rug
pperron ukg
pperron d.ukg
pperron usg
pperron d.usg
pperron olg
pperron d.olg
pperron urg
pperron d.urg


kpsstest arg
kpsstest d.arg
kpsstest aug
kpsstest d.aug
kpsstest cag
kpsstest d.cag
kpsstest eug
kpsstest d.eug
kpsstest rug
kpsstest d.rug
kpsstest ukg
kpsstest d.ukg
kpsstest usg
kpsstest d.usg
kpsstest olg
kpsstest d.olg
kpsstest urg
kpsstest d.urg


//Need to include structural break dummies

///Common structural break

drop co1 co2 co3  co5

gen co1= ar1* au1 *cn1 *eu1 *ru1 *uk1 *us1
gen co2= ar2* au2 *cn2 *eu2 *ru2 *uk2 *us2
gen co3= ar3* au3 *cn3 *eu3 *ru3 *uk3 *us3
gen co4=  au4 *cn4 *eu4 *ru4 *uk4 *us4
gen co5= ar4* au5 *cn5*eu5 *ru5 *uk5 *us5


///two lags
varsoc arg aug cag eug rug ukg usg





////Structural break


xtbreak arg aug cag eug rug ukg usg olg urg
xtbreak aug arg  cag eug rug ukg usg olg urg
xtbreak cag arg aug  eug rug ukg usg olg urg
xtbreak eug arg aug cag  rug ukg usg olg urg
xtbreak rug arg aug cag eug  ukg usg olg urg
xtbreak ukg arg aug cag eug rug  usg olg urg
xtbreak usg arg aug cag eug rug ukg  olg urg
xtbreak olg usg arg aug cag eug rug ukg   urg
xtbreak urg olg usg arg aug cag eug rug ukg   



///VAR model

var arg aug cag eug rug ukg usg, lag(1/2) exo( olg urg co1 co2 co3 co4 co5)
esttab using whe1.rtf, b(a2) se (2) starlevels (* 0.10 ** 0.05 *** 0.01) replace label nogap onecell


///Model test
varlmar, mlag(2)
varnorm, jbera
varstable, graph


///test of one price

//Joint significance
test l.arg =l.aug =l.cag =l.eug =l.rug =l.ukg =l.usg

test l.arg =l.aug
test l.arg =l.cag
test l.arg =l.eug
test l.arg =l.rug
test l.arg =l.ukg
test l.arg =l.usg

test l.aug =l.cag
test l.aug =l.eug
test l.aug=l.rug
test l.aug=l.ukg
test l.aug =l.usg

test l.cag =l.eug
test l.cag =l.rug
test l.cag =l.ukg
test l.cag =l.usg

test l.eug =l.rug
test l.eug =l.ukg
test l.eug =l.usg

test l.rug =l.ukg
test l.rug =l.usg

test l.ukg =l.usg


///Testing one

test l.arg -l.aug -l.cag -l.eug -l.rug -l.ukg -l.usg-1=0


///Granger Causality
vargranger

///Test for cointegration
vecrank arg aug cag eug rug ukg usg

////Optimal lag length
varsoc arg
varsoc aug
varsoc cag
varsoc eug
varsoc rug 
varsoc ukg
varsoc usg

////ARDL model

//Argentina

ardl arg aug cag eug rug ukg usg ,  lag (3 2 2 2 2 2 3 ) exog(olg urg ar1 ar2 ar3 ar4 ) ec btest
esttab using pol1.rtf, b(a2) se (2) starlevels (* 0.10 ** 0.05 *** 0.01) replace label nogap onecell

//a Durbin–Watson d-statistic
estat dwatson
estat bgodfrey, lags (3)

//b. Heteroskedasticity
estat imtest, white

//c.Model Stability

cusum6 arg aug cag eug rug ukg usg olg urg ar1 ar2 ar3 ar4, cs(cusum) lw(lower) uw(upper)
drop cusum upper lower


//Australia

ardl aug arg  cag eug rug ukg usg ,  lag (2 3  2 2 2 2 3 ) exog(olg urg au1 au2 au3 au4 au5 ) ec btest
esttab using pol2.rtf, b(a2) se (2) starlevels (* 0.10 ** 0.05 *** 0.01) replace label nogap onecell

//a Durbin–Watson d-statistic
estat dwatson
estat bgodfrey, lags (2)

//b. Heteroskedasticity
estat imtest, white

//c.Model Stability

cusum6 aug arg  cag eug rug ukg usg olg urg au1 au2 au3 au4 au5 , cs(cusum) lw(lower) uw(upper)
drop cusum upper lower


//Canada

ardl cag arg aug  eug rug ukg usg ,  lag (2 3 2  2 2 2 3 ) exog(olg urg cn1 cn2 cn3 cn4 cn5) ec btest
esttab using pol13.rtf, b(a2) se (2) starlevels (* 0.10 ** 0.05 *** 0.01) replace label nogap onecell

//a Durbin–Watson d-statistic
estat dwatson
estat bgodfrey, lags (2)

//b. Heteroskedasticity
estat imtest, white

//c.Model Stability

cusum6 cag aug arg   eug rug ukg usg usg olg urg cn1 cn2 cn3 cn4 cn5 , cs(cusum) lw(lower) uw(upper)
drop cusum upper lower





//EU


ardl eug  arg aug cag rug ukg usg ,  lag (2 3 2 2   2 2 3 ) exog(olg urg eu1 eu2 eu3 eu4 eu5) ec btest
esttab using pol14.rtf, b(a2) se (2) starlevels (* 0.10 ** 0.05 *** 0.01) replace label nogap onecell

//a Durbin–Watson d-statistic
estat dwatson
estat bgodfrey, lags (2)

//b. Heteroskedasticity
estat imtest, white

//c.Model Stability

cusum6 eug cag aug arg  rug ukg usg olg urg eu1 eu2 eu3 eu4 eu5 , cs(cusum) lw(lower) uw(upper)
drop cusum upper lower



//Russia

ardl rug arg aug cag eug  ukg usg ,  lag (2 3 2 2 2 2 3 ) exog(olg urg ru1 ru2 ru3 ru4 ru5) ec btest
esttab using pol15.rtf, b(a2) se (2) starlevels (* 0.10 ** 0.05 *** 0.01) replace label nogap onecell

//a Durbin–Watson d-statistic
estat dwatson
estat bgodfrey, lags (2)

//b. Heteroskedasticity
estat imtest, white

//c.Model Stability

cusum6 rug eug cag aug arg  ukg usg olg urg ru1 ru2 ru3 ru4 ru5 , cs(cusum) lw(lower) uw(upper)
drop cusum upper lower


//Ukraine

ardl ukg arg aug cag  eug   rug usg ,  lag (2 3 2 2 2 2  3 ) exog(olg urg uk1 uk2 uk3 uk4 uk5) ec btest
esttab using pol16.rtf, b(a2) se (2) starlevels (* 0.10 ** 0.05 *** 0.01) replace label nogap onecell

//a Durbin–Watson d-statistic
estat dwatson
estat bgodfrey, lags (2)

//b. Heteroskedasticity
estat imtest, white

//c.Model Stability

cusum6 ukg eug cag aug arg  rug  usg olg urg uk1 uk2 uk3 uk4 uk5, cs(cusum) lw(lower) uw(upper)
drop cusum upper lower


//USA

ardl usg arg aug cag eug rug ukg    ,  lag (3 3 2 2 2 2 2  ) exog(olg urg us1 us2 us3 us4 us5) ec btest
esttab using pol17.rtf, b(a2) se (2) starlevels (* 0.10 ** 0.05 *** 0.01) replace label nogap onecell

//a Durbin–Watson d-statistic
estat dwatson
estat bgodfrey, lags (3)

//b. Heteroskedasticity
estat imtest, white

//c.Model Stability

cusum6 usg ukg eug cag aug arg  rug   olg urg us1 us2 us3 us4 us5, cs(cusum) lw(lower) uw(upper)
drop cusum upper lower
//Data for journal submission

save "C:\Users\Kmottale\Documents\USA-Wheatprice\newwheat1.dta",


